#include "SendThread.h"
#include "MessageHelper.h"
#include <QDebug>

MsgQueue queue_send;

void SendThread::run() {
    qDebug() << "start sending thread: " << QThread::currentThreadId();
    while (true) {
        queue_lock.lock();
        while (queue_send.empty()) {
            queue_waitCond.wait(&queue_lock, 5);
        }
        MSG msg = queue_send.front();
        queue_send.pop_front();
        queue_lock.unlock();

        emit messageReady(msg);  // 通知 socket 线程去发
    }
}